<?php 
namespace app\modules\base;
use think\Controller;
/**
 * Class LogicBase 内部业务逻辑层抽象基类
 */
class LogicBase extends Controller
{
	public $_error = [];
	function _initialize()
	{
		# code...
	}

	/**
	 * 获取错误信息，支持定义多消息
	 * @param string $format
	 * @return string
	 */
	final public function getError($format = ';')
	{
		if (!is_array($this->_error) || count($this->_error) < 1) {
            return '';
		}
		if ('p' == $format) {
			return '<p>' . implode('</p><p>', $this->_error) . '</p>';
		} elseif ('li' == $format) {
			return '<li>' . implode('</li><li>', $this->_error) . '</li>';
		} elseif ('br' == $format) {
			return implode('<br>', $this->_error);
		} else {
			return implode('; ', $this->_error);
		}
	}


}